package community.mapper;

import community.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/**
 * @author : 赵静超
 * @version V1.0
 * @Project: community
 * @Package community.mapper
 * @Description: TODO
 * @date Date : 2019/9/1 21:50
 */

@Mapper
public interface UserMapper {

    @Insert("insert into user (name,account_id,token,gmt_create,gmt_modify) values (#{name},#{accountId},#{token},#{gmtCreate},#{gmtModify})")
    void insert(User user); //抽象类默认方法为public

    @Select("select * from user where token = #{token}")
    User findByToken(@Param("token") String token);        //如果该方法的参数不是类，而是普通属性，就需要添加注解 @Param("token")
}
